<template>
    <div>
        <div class="banner" @click="bannerClick">
            <img :src="bannerImg" />
            <div class="banner-info">
                <p class="banner-number">{{bannerImgs.length}}<icon class="icon">&#xe692;</icon></p>
                <p class="banner-title">{{sightName}}</p>
            </div>
        </div>
        <fade-animation>
        <common-gallary :imgs="bannerImgs" v-show="showGallary" @close="gallaryClose">
        </common-gallary>
        </fade-animation>
    </div>
</template>

<script>
import icon from "icon/icon";
import CommonGallary from "common/gallary/gallary";
import FadeAnimation from "common/fade/fade";
export default {
  name: "DetailBanner",
  components: {
    icon,
    CommonGallary,
    FadeAnimation
  },
  props: {
    sightName: String,
    bannerImg: String,
    bannerImgs: Array
  },
  data() {
    return {
      imgs: [
        "http://img1.qunarzz.com/sight/p0/1510/94/9444e7f17bee441a.img.jpg_r_800x800_7861b20b.jpg"
      ],
      showGallary: false
    };
  },
  methods: {
    bannerClick() {
      this.showGallary = true;
    },
    gallaryClose() {
      this.showGallary = false;
    }
  }
};
</script>

<style lang="stylus" scoped>
.banner {
    overflow: hidden;
    height: 0;
    padding-bottom: 55%;
    position: relative;

    img {
        width: 100%;
    }
}

.banner-info {
    position: absolute;
    z-index: 3;
    left: 0;
    width: 100%;
    padding-left: 0.3rem;
    padding-bottom: 0.3rem;
    bottom: 0;
    color: #ffffff;
    background-image: linear-gradient(top, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.8));
}

.banner-number {
    display: inline-block;
    padding: 0.1rem 0.3rem;
    border-radius: 0.5rem;
    background: rgba(0, 0, 0, 0.5);
    font-size: 0.24rem;

    .icon {
        margin-left: 0.1rem;
        font-size: 0.24rem;
    }
}

.banner-title {
    font-size: 0.5rem;
    margin-top: 0.14rem;
}
</style>